Evolutionary lottery of skull and beak morphology


Beak and skull shapes in birds of prey (“raptors”) are strongly coupled and largely controlled by size.

gif provided by the awesome Jen Bright @MorphobeakGeek!

In this exercise we will use a github repo to collaboratively collate and simulate evolutionary trajectories for each participants’ species body size using a simple brownian motion evolutionary model. This assumes evolutionary steps to progress comletely at random. You could say:

it’s a bit of lottery!


Each participant has created and contributed a file specifying the parameters required to simulate and plot their species evolutionary trajectory. We’ve collect all participants’ files in the master repo. Next we need to simulate species trajectories plot them up.

Participants will then get to see the skull and beak shape corresponding to their species relative body size!


setup

First we load the required packages and create some objects to compile data on trait evolution for each species.

require(dplyr)
require(ggplot2)
require(plotly)
set.seed(1)

t <- 0:100  # generate time vector
dt <- NULL # generate object to compile time-series data
cols <- NULL # generate object to compile trendline colours

Simulate trait evolution, iterate over all species files in params/ folder

We’ll use the parameters supplied in your scripts to generate brownian trait evolution trendline for each species.

spp.files <- dir("params/")[dir("params/") != "params_tmpl.R"]

for(spp in spp.files){
  # source parameters for each species
  source(file.path("params", spp))
  
  # generate trait evolution time-series and compile plotting data
  dt <-  rbind(dt, data.frame(t, 
                              trait = c(0, rnorm(n = length(t) - 1, sd = sqrt(sig2)) %>% cumsum()),
                              species = species.name))
  cols <- c(cols, color)
}

Plot trait evolution timeseries

Use the data generated to plot all species.

p <- ggplot(data = dt, aes(x = t, y = trait, group = species, colour = species)) + 
  geom_line() + 
  scale_colour_manual(values = cols) 
  
  ggplotly(p)



Skulls! find the skull associated with your species:


Skulls are organised from largest to smallest. The largest skulls are vulture-like, (e.g. no. 50, the Andean condor Vultur gryphus) and the smallest are falconet-like, (e.g. no. 1 Collared falconet Microhierax caerulescens)

No: 47 marco_pigeons

No: 44 lewisus_beakmaximii

No: 42 Lucius_wilvus

No: 40 nighthawk_stuartbroad

No: 39 amberus_landy

No: 32 mattus_smithii

No: 31 carlus_suligoii

No: 31 big_bird

No: 27 Remyus_venerus

No: 22 Carrot catticus

No: 22 melissa_shawbird

No: 20 happy_alien

No: 19 Amy Smallshaw

No: 14 davidus_wilbyii

No: 7 owl_futuramii

No: 2 sillius_parrotus

Session Info

sessioninfo::session_info()
## ─ Session info ───────────────────────────────────────────────────────────────
##  setting  value                       
##  version  R version 4.1.2 (2021-11-01)
##  os       Ubuntu 18.04.6 LTS          
##  system   x86_64, linux-gnu           
##  ui       X11                         
##  language en_GB:en                    
##  collate  en_GB.UTF-8                 
##  ctype    en_GB.UTF-8                 
##  tz       Europe/London               
##  date     2022-07-26                  
## 
## ─ Packages ───────────────────────────────────────────────────────────────────
##  ! package     * version date       lib source        
##    bslib         0.3.1   2021-10-06 [1] CRAN (R 4.1.2)
##    cli           3.1.0   2021-10-27 [1] CRAN (R 4.1.2)
##    colorspace    2.0-2   2021-06-24 [1] CRAN (R 4.1.2)
##    crayon        1.4.2   2021-10-29 [1] CRAN (R 4.1.2)
##    crosstalk     1.1.1   2021-01-12 [1] CRAN (R 4.1.2)
##    data.table    1.14.2  2021-09-27 [1] CRAN (R 4.1.2)
##    digest        0.6.28  2021-09-23 [1] CRAN (R 4.1.2)
##    dplyr       * 1.0.7   2021-06-18 [1] CRAN (R 4.1.2)
##    ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.1.2)
##  P evaluate      0.14    2019-05-28 [?] CRAN (R 4.1.1)
##    fansi         0.5.0   2021-05-25 [1] CRAN (R 4.1.2)
##    fastmap       1.1.0   2021-01-25 [1] CRAN (R 4.1.2)
##    generics      0.1.1   2021-10-25 [1] CRAN (R 4.1.2)
##    ggplot2     * 3.3.5   2021-06-25 [1] CRAN (R 4.1.2)
##    glue          1.5.0   2021-11-07 [1] CRAN (R 4.1.2)
##    gtable        0.3.0   2019-03-25 [1] CRAN (R 4.1.2)
##    htmltools     0.5.2   2021-08-25 [1] CRAN (R 4.1.2)
##    htmlwidgets   1.5.4   2021-09-08 [1] CRAN (R 4.1.2)
##    httr          1.4.2   2020-07-20 [1] CRAN (R 4.1.2)
##    jquerylib     0.1.4   2021-04-26 [1] CRAN (R 4.1.2)
##    jsonlite      1.7.2   2020-12-09 [1] CRAN (R 4.1.2)
##    knitr         1.36    2021-09-29 [1] CRAN (R 4.1.2)
##    labeling      0.4.2   2020-10-20 [1] CRAN (R 4.1.2)
##    lazyeval      0.2.2   2019-03-15 [1] CRAN (R 4.1.2)
##    lifecycle     1.0.1   2021-09-24 [1] CRAN (R 4.1.2)
##    magrittr      2.0.1   2020-11-17 [1] CRAN (R 4.1.2)
##    munsell       0.5.0   2018-06-12 [1] CRAN (R 4.1.2)
##    pillar        1.6.4   2021-10-18 [1] CRAN (R 4.1.2)
##    pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.1.2)
##    plotly      * 4.9.4.1 2021-06-18 [1] CRAN (R 4.1.2)
##    purrr         0.3.4   2020-04-17 [1] CRAN (R 4.1.2)
##    R6            2.5.1   2021-08-19 [1] CRAN (R 4.1.2)
##    renv          0.14.0  2021-07-21 [1] CRAN (R 4.1.2)
##    rlang         0.4.12  2021-10-18 [1] CRAN (R 4.1.2)
##    rmarkdown     2.10    2021-08-06 [1] CRAN (R 4.1.2)
##    rstudioapi    0.13    2020-11-12 [1] CRAN (R 4.1.2)
##    sass          0.4.1   2022-03-23 [1] CRAN (R 4.1.2)
##    scales        1.1.1   2020-05-11 [1] CRAN (R 4.1.2)
##    sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.1.2)
##    stringi       1.7.6   2021-11-29 [1] CRAN (R 4.1.2)
##  P stringr       1.4.0   2019-02-10 [?] CRAN (R 4.1.1)
##    tibble        3.1.6   2021-11-07 [1] CRAN (R 4.1.2)
##    tidyr         1.1.4   2021-09-27 [1] CRAN (R 4.1.2)
##    tidyselect    1.1.1   2021-04-30 [1] CRAN (R 4.1.2)
##    utf8          1.2.2   2021-07-24 [1] CRAN (R 4.1.2)
##    vctrs         0.3.8   2021-04-29 [1] CRAN (R 4.1.2)
##    viridisLite   0.4.0   2021-04-13 [1] CRAN (R 4.1.2)
##    withr         2.4.2   2021-04-18 [1] CRAN (R 4.1.2)
##    xfun          0.28    2021-11-04 [1] CRAN (R 4.1.2)
##  P yaml          2.2.1   2020-02-01 [?] CRAN (R 4.1.1)
## 
## [1] /home/ac1dwi/RSE-Sheffield/collaborative_github_exercise/renv/library/R-4.1/x86_64-pc-linux-gnu
## [2] /tmp/RtmpEozPZm/renv-system-library
## 
##  P ── Loaded and on-disk path mismatch.

This projects uses renv for dependency management.